home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWArcShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.3 KB  |  117 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWArcShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWARCSHP_H
  11. #define FWARCSHP_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWSTDDEF_H
  20. #include <FWStdDef.h>
  21. #endif
  22.  
  23. //========================================================================================
  24. //    Forward Declarations
  25. //========================================================================================
  26.  
  27. class FW_CGraphicContext;
  28.  
  29. //========================================================================================
  30. //    class FW_CArcShape
  31. //========================================================================================
  32.  
  33. class FW_CArcShape : public FW_CBoundedShape
  34. {
  35. public:
  36.     FW_DECLARE_CLASS
  37.     FW_DECLARE_AUTO(FW_CArcShape)
  38.  
  39. //----------------------------------------------------------------------------------------
  40. //    Constructors/Destructors
  41. //
  42. public:
  43.     FW_CArcShape(const FW_CRect& rect, 
  44.                 short startAngle, short arcAngle,
  45.                  FW_ERenderVerbs renderVerb,
  46.                  const FW_CInk& ink = FW_kNormalInk,
  47.                  const FW_CStyle& style = FW_kNormalStyle);
  48.  
  49.     FW_CArcShape(const FW_CArcShape& other);
  50.     FW_CArcShape(FW_CReadableStream& stream);
  51.     
  52.     virtual ~ FW_CArcShape();
  53.  
  54. //----------------------------------------------------------------------------------------
  55. //    Operators
  56. //
  57. public:
  58.     FW_CArcShape& operator=(const FW_CArcShape& other);
  59.     
  60. //----------------------------------------------------------------------------------------
  61. //    Inherited API
  62. //
  63. public:
  64.     // ----- Rendering -----
  65.     virtual void                 Render(FW_CGraphicContext& gc) const;
  66.                                 
  67.     // ----- Hit Testing -----
  68.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  69.                                         const FW_CPoint& test,
  70.                                         FW_Fixed tolerance) const;
  71.  
  72.     // ----- Copying -----
  73.     virtual FW_CShape*            Copy() const;
  74.     
  75.     // ----- Flatten -----
  76.     virtual void                Flatten(FW_CWritableStream& stream) const;
  77.     static void*                 Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  78.  
  79. //----------------------------------------------------------------------------------------
  80. //    New API
  81. //
  82. public:
  83.     // ----- Rendering -----
  84.     static void                 RenderArc(FW_CGraphicContext& gc,
  85.                                             const FW_CRect& rect, 
  86.                                             short startAngle, short arcAngle,
  87.                                             FW_ERenderVerbs renderVerb,
  88.                                             const FW_CInk& ink = FW_kNormalInk,
  89.                                             const FW_CStyle& style = FW_kNormalStyle);
  90.  
  91.     // ----- Geometry -----
  92.     void                        GetGeometry(FW_CRect& rect, short& startAngle, short& arcAngle) const;
  93.     void                        SetGeometry(const FW_CRect& rect, short startAngle, short arcAngle);
  94.  
  95.     short                        GetStartAngle() const
  96.                                     {return fStartAngle;}    
  97.     void                        SetStartAngle(short angle)
  98.                                     {fStartAngle = angle;}
  99.     
  100.     short                        GetArcAngle() const
  101.                                     {return fArcAngle;}    
  102.     void                        SetArcAngle(short angle)
  103.                                     {fArcAngle = angle;}
  104.  
  105. private:
  106.     short                         CalcAngle(const FW_CPoint& test) const;
  107.  
  108. //----------------------------------------------------------------------------------------
  109. //    Data Members
  110. //
  111. private:
  112.     short            fStartAngle;    
  113.     short            fArcAngle;
  114. };
  115.  
  116. #endif
  117.